{include file="kuyou/common/menu" /}
<div class="">
    <a href="{:url('kuyou/prints/prints',['id'=>$row.id,'type'=>'zzd'])}" target="_blank" class="layui-btn layui-icon-btn layui-btn-sm layui-btn-danger fright {if condition="$auth->check($nowmenu.'/printss')!=1"}hiddens{/if}" style="margin-left: 10px;padding-left: 10px;">{:__('Print')}</a>
</div>
<form id="edit-form" class="form-horizontal assemble_form" role="form" data-toggle="validator" method="POST" action="">

    <div class="row">
        <div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-4">{:__('Purchase_code')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-purchase_code" class="form-control" data-rule="required" value="{$row.purchase_code|default=''}" name="row[purchase_code]" type="text" placeholder="{:__('Purchase_code')}">
                    <input type="hidden" name="row[old_purchase_code]" value="{$row.purchase_code|default=''}">
                </div>
            </div>
        </div>
        <div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-4">{:__('Purchase_time')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-purchase_time" class="form-control datetime" data-use-current="true" name="row[purchase_time]" type="text" value="{$row.purchase_time|date='Y-m-d',###}" placeholder="{:__('Purchase_time')}">
                </div>
            </div>
        </div>
    </div>

    <div class="table_box">
        <div class="row">
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                <div class="form-group">
                    <button type="button" class="btn_mb mb_list btn btn-default btn-embossed">{:__('Select Template')}</button>
                    <button type="button" class="btn_mb mb_preservation btn btn-default btn-embossed">{:__('Save as Template')}</button>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-12" style="text-align: left;font-weight: bold;">{:__('Composite components')}：</label>
                </div>
            </div>
        </div>
        <div class="list" style="overflow-x: auto">
            <table id="assemble_table">
                <tr>
                    <th>
                        <span class="must">*</span>
                        {:__('commodity')}
                        <span class="smq_switch">
                            <span>--{:__('Scan code gun input')}</span>
                            <span>
                                <input  id="c-switchs" name="row[switchs]" type="hidden" value="0">
                                <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-switchs" data-yes="1" data-no="0" >
                                    <i class="fa fa-toggle-on text-success fa-2x fa-flip-horizontal text-gray"></i>
                                </a>
                            </span>
                        </span>
                    </th>
                    <th class="goods_attr_sd">{:__('Goods_attr')}</th><th>{:__('Goods_unit')}</th><th>{:__('Stores_id')}</th><th>{:__('Allow_stock')}</th>
                    <th class="goods_batch_sd">{:__('batch')}</th><th class="goods_batch_sd">{:__('date of manufacture')}</th><th class="goods_batch_sd">{:__('quality guarantee period')}({:__('day')})</th><th class="goods_batch_sd">{:__('Valid until')}</th>
                    <th>{:__('Number')}</th><th> {:__('Storage unit cost')}</th><th> {:__('Storage cost')}</th><th>{:__('Remark')}</th>
                </tr>
                {foreach name="info_list" item="info" key="k"}
                {if condition="$info.type==1"}
                <tr>
                    <td>
                        <div class="goods_code_box">
                            <input type="hidden" name="row[goods_code][]" class="goods_code" value="{$info.goods_code}">
                            <span class="goods_code_spans"><img src="__CDN__/assets/addons/kuyou/img/more.png"></span>
                            <input type="text" class="ipt goods_names" value="{$info.goods_name}">
                        </div>
                    </td>
                    <td class="goods_attr_sd">
                        <div>
                            <select name="row[goods_attr][]" class="form-control goods_attr">
                                <option value=""></option>
                                {foreach name="info.unit.attr" item="vo"}
                                <option value="{$vo.id}" {if condition="$vo.id==$info.goods_attr"}selected{/if}>{$vo.attr_name}</option>
                                {/foreach}
                            </select>
                        </div>
                    </td>
                    <td>
                        <div>
                            <select name="row[goods_unit][]" class="form-control goods_unit">
                                <option value=""></option>
                                {foreach name="info.unit.unit" item="vo"}
                                <option value="{$vo.id}" {if condition="$vo.id==$info.goods_unit"}selected{/if}>{$vo.name}</option>
                                {/foreach}
                            </select>
                        </div>
                    </td>
                    <td>
                        <div>
                            <select name="row[stores_id][]" class="form-control stores_id">
                                <option value=""></option>
                                {foreach name="storesList" item="vo"}
                                <option value="{$vo.id}" {if condition="$vo.id==$info.stores_id"}selected{/if}>{$vo.name}</option>
                                {/foreach}
                            </select>
                        </div>
                    </td>
                    <td>
                        <div>
                            <input type="number" name="row[allow_stock][]" class="allow_stock" value="{$info.allow_stock}" readonly>
                        </div>
                    </td>
                    <td class="goods_batch_sd">
                        <div>
                            <div class="batch_div">
                                <input name="row[batch][]" class="batch_sec" value="{$info.batch}">
                                <input type="hidden" name="row[batch_id][]" value="{$info.batch_id}" class="batch_id">
                                <span class="batch_span"><img src="__CDN__/assets/addons/kuyou/img/more.png"></span>
                            </div>
                        </div>
                    </td>
                    <td class="goods_batch_sd"><div><input type="text" class="ipt manufacture" name="row[manufacture][]" value="{if condition="!empty($info['manufacture'])"}{$info.manufacture|date='Y-m-d',###}{/if}"></div></td>
                    <td class="goods_batch_sd"><div><input type="text" class="ipt guarantee" name="row[guarantee][]" value="{if condition="!empty($info['manufacture'])"}{$info.guarantee|htmlentities}{/if}"></div></td>
                    <td class="goods_batch_sd"><div><input type="text" class="ipt validity" name="row[validity][]" value="{if condition="!empty($info['validity'])"}{$info.validity|date='Y-m-d',###}{/if}"></div></td>

                    <td>
                        <div>
                            <input type="number" name="row[number][]" value="{$info.number|htmlentities}" class="number number_p number_decimal number_decimal">
                            <input type="hidden" class="period_period" name="row[period_period][]" value='{$info.period}'>
                        </div>
                    </td>
                    <td><div><input type="number" name="row[unit_cost][]" class="unit_price price_decimal" value="{$info.unit_cost}"></div></td>
                    <td><div><input type="number" name="row[cost_money][]" class="all_money" value="{$info.cost_money}"></div></td>
                    <td><div><input type="text" name="row[remark][]" class="remark" value="{$info.remark}"></div></td>
                </tr>
                {/if}
                {/foreach}
            </table>
        </div>
        <div class="row">
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-12" style="text-align: left;font-weight: bold;">{:__('Subitem')}：</label>
                </div>
            </div>
        </div>
        <div style="position: relative">
            {if condition="$row.examine_status==1 && isset($set['examine']['is_checked']) && $set['examine']['is_checked']==1"}
            <div id="mark" class="has-audit"></div>
            {/if}
            <div class="list" style="overflow-x: auto;position: relative">
                <table id="assemble_table_c">
                    <tr>
                        <th></th>
                        <th>
                            <span class="must">*</span>
                            {:__('commodity')}
                            <span class="smq_switch">
                            <span>--{:__('Scan code gun input')}</span>
                            <span>
                                <input  id="c-switch" name="row[switch]" type="hidden" value="0">
                                <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-switch" data-yes="1" data-no="0" >
                                    <i class="fa fa-toggle-on text-success fa-2x fa-flip-horizontal text-gray"></i>
                                </a>
                            </span>
                        </span>
                        </th>
                        <th class="goods_attr_sd">{:__('Goods_attr')}</th><th>{:__('Goods_unit')}</th><th>{:__('Stores_id')}</th><th>{:__('Allow_stock')}</th>
                        <th class="goods_batch_sd">{:__('batch')}</th><th class="goods_batch_sd">{:__('date of manufacture')}</th><th class="goods_batch_sd">{:__('quality guarantee period')}({:__('day')})</th><th class="goods_batch_sd">{:__('Valid until')}</th>
                        <th>{:__('Number')}</th><th> {:__('Storage unit cost')}</th><th> {:__('Storage cost')}</th><th>{:__('Remark')}</th>
                    </tr>
                    <tr style="display: none">
                        <td><div class="btn"><span class="add"><i class="fa fa-plus"></i></span><span class="del"><i class="fa fa-trash"></i></span></div></td>
                        <td>
                            <div class="goods_code_box">
                                <input type="hidden" name="row[goods_code][]" class="goods_code">
                                <span class="goods_code_span"><img src="__CDN__/assets/addons/kuyou/img/more.png"></span>
                                <input type="text" class="ipt goods_name">
                            </div>
                        </td>
                        <td class="goods_attr_sd">
                            <div>
                                <select name="row[goods_attr][]" class="form-control goods_attr">
                                    <option value=""></option>
                                </select>
                            </div>
                        </td>
                        <td>
                            <div>
                                <select name="row[goods_unit][]" class="form-control goods_unit">
                                    <option value=""></option>
                                </select>
                            </div>
                        </td>
                        <td>
                            <div>
                                <select name="row[stores_id][]" class="form-control stores_id">
                                    <option value=""></option>
                                    {foreach name="storesList" item="vo"}
                                    <option value="{$vo.id}">{$vo.name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </td>
                        <td><div><input type="number" name="row[allow_stock][]" class="allow_stock" readonly><input type="hidden" name="row[info_id][]" value=""></div></td>

                        <td class="goods_batch_sd">
                            <div>
                                <div class="batch_div">
                                    <input name="row[batch][]" class="batch_sec"><input type="hidden" name="row[batch_id][]" class="batch_id">
                                    <span class="batch_span"><img src="__CDN__/assets/addons/kuyou/img/more.png"></span>
                                </div>
                            </div>
                        </td>
                        <td class="goods_batch_sd"><div><input type="text" class="ipt manufacture" name="row[manufacture][]"></div></td>
                        <td class="goods_batch_sd"><div><input type="text" class="ipt guarantee" name="row[guarantee][]"></div></td>
                        <td class="goods_batch_sd"><div><input type="text" class="ipt validity" name="row[validity][]"></div></td>

                        <td>
                            <div>
                                <input type="number" name="row[number][]" class="number number_decimal number_decimal">
                                <input type="hidden" class="period_period" name="row[period_period][]">
                            </div>
                        </td>
                        <td><div><input type="number" name="row[unit_cost][]" class="unit_price price_decimal"></div></td>
                        <td><div><input type="number" name="row[cost_money][]" class="all_money"></div></td>
                        <td><div><input type="text" name="row[remark][]" class="remark"></div></td>
                    </tr>
                    {foreach name="info_list" item="info" key="k"}
                    {if condition="$info.type==2"}
                    <tr>
                        <td><div class="btn"><span class="add"><i class="fa fa-plus"></i></span><span class="del"><i class="fa fa-trash"></i></span></div></td>
                        <td>
                            <div class="goods_code_box">
                                <input type="hidden" name="row[goods_code][]" class="goods_code" value="{$info.goods_code}">
                                <span class="goods_code_span"><img src="__CDN__/assets/addons/kuyou/img/more.png"></span>
                                <input type="text" class="ipt goods_name" value="{$info.goods_name}">
                            </div>
                        </td>
                        <td class="goods_attr_sd">
                            <div>
                                <select name="row[goods_attr][]" class="form-control goods_attr">
                                    <option value=""></option>
                                    {foreach name="info.unit.attr" item="vo"}
                                    <option value="{$vo.id}" {if condition="$vo.id==$info.goods_attr"}selected{/if}>{$vo.attr_name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </td>
                        <td>
                            <div>
                                <select name="row[goods_unit][]" class="form-control goods_unit">
                                    <option value=""></option>
                                    {foreach name="info.unit.unit" item="vo"}
                                    <option value="{$vo.id}" {if condition="$vo.id==$info.goods_unit"}selected{/if}>{$vo.name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </td>
                        <td>
                            <div>
                                <select name="row[stores_id][]" class="form-control stores_id">
                                    <option value=""></option>
                                    {foreach name="storesList" item="vo"}
                                    <option value="{$vo.id}" {if condition="$vo.id==$info.stores_id"}selected{/if}>{$vo.name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </td>
                        <td>
                            <div>
                                <input type="number" name="row[allow_stock][]" class="allow_stock" value="{$info.allow_stock}" readonly>
                            </div>
                        </td>
                        <td class="goods_batch_sd">
                            <div>
                                <div class="batch_div">
                                    <input name="row[batch][]" class="batch_sec" value="{$info.batch}">
                                    <input type="hidden" name="row[batch_id][]" value="{$info.batch_id}" class="batch_id">
                                    <span class="batch_span"><img src="__CDN__/assets/addons/kuyou/img/more.png"></span>
                                </div>
                            </div>
                        </td>
                        <td class="goods_batch_sd"><div><input type="text" class="ipt manufacture" name="row[manufacture][]" value="{if condition="!empty($info['manufacture'])"}{$info.manufacture|date='Y-m-d',###}{/if}"></div></td>
                        <td class="goods_batch_sd"><div><input type="text" class="ipt guarantee" name="row[guarantee][]" value="{if condition="!empty($info['manufacture'])"}{$info.guarantee|htmlentities}{/if}"></div></td>
                        <td class="goods_batch_sd"><div><input type="text" class="ipt validity" name="row[validity][]" value="{if condition="!empty($info['validity'])"}{$info.validity|date='Y-m-d',###}{/if}"></div></td>

                        <td>
                            <div>
                                <input type="number" name="row[number][]" value="{$info.number|htmlentities}" class="number number_decimal number_decimal">
                                <input type="hidden" class="period_period" name="row[period_period][]" value='{$info.period}'>
                            </div>
                        </td>
                        <td><div><input type="number" name="row[unit_cost][]" class="unit_price price_decimal" value="{$info.unit_cost}"></div></td>
                        <td><div><input type="number" name="row[cost_money][]" class="all_money" value="{$info.cost_money}"></div></td>
                        <td><div><input type="text" name="row[remark][]" class="remark" value="{$info.remark}"></div></td>
                    </tr>
                    {/if}
                    {/foreach}
                    {php}for($a=0;$a<(4-sizeof($info_list));$a++){ {/php}
                    <tr style="">
                        <td><div class="btn"><span class="add"><i class="fa fa-plus"></i></span><span class="del"><i class="fa fa-trash"></i></span></div></td>
                        <td>
                            <div class="goods_code_box">
                                <input type="hidden" name="row[goods_code][]" class="goods_code">
                                <span class="goods_code_span"><img src="__CDN__/assets/addons/kuyou/img/more.png"></span>
                                <input type="text" class="ipt goods_name">
                            </div>
                        </td>
                        <td class="goods_attr_sd">
                            <div>
                                <select name="row[goods_attr][]" class="form-control goods_attr">
                                    <option value=""></option>
                                </select>
                            </div>
                        </td>
                        <td>
                            <div>
                                <select name="row[goods_unit][]" class="form-control goods_unit">
                                    <option value=""></option>
                                </select>
                            </div>
                        </td>
                        <td>
                            <div>
                                <select name="row[stores_id][]" class="form-control stores_id">
                                    <option value=""></option>
                                    {foreach name="storesList" item="vo"}
                                    <option value="{$vo.id}">{$vo.name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </td>
                        <td><div><input type="number" name="row[allow_stock][]" class="allow_stock" readonly><input type="hidden" name="row[info_id][]" value=""></div></td>

                        <td class="goods_batch_sd">
                            <div>
                                <div class="batch_div">
                                    <input name="row[batch][]" class="batch_sec"><input type="hidden" name="row[batch_id][]" class="batch_id">
                                    <span class="batch_span"><img src="__CDN__/assets/addons/kuyou/img/more.png"></span>
                                </div>
                            </div>
                        </td>
                        <td class="goods_batch_sd"><div><input type="text" class="ipt manufacture" name="row[manufacture][]"></div></td>
                        <td class="goods_batch_sd"><div><input type="text" class="ipt guarantee" name="row[guarantee][]"></div></td>
                        <td class="goods_batch_sd"><div><input type="text" class="ipt validity" name="row[validity][]"></div></td>

                        <td>
                            <div>
                                <input type="number" name="row[number][]" class="number number_decimal number_decimal">
                                <input type="hidden" class="period_period" name="row[period_period][]">
                            </div>
                        </td>
                        <td><div><input type="number" name="row[unit_cost][]" class="unit_price price_decimal"></div></td>
                        <td><div><input type="number" name="row[cost_money][]" class="all_money"></div></td>
                        <td><div><input type="text" name="row[remark][]" class="remark"></div></td>
                    </tr>
                    {php}}{/php}
                </table>
            </div>
        </div>
    </div>
    <div class="chose_goods_boxs"></div>

    <div class="row" style="margin-bottom: 10px;">
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
            <textarea id="c-note" class="form-control" rows="4" name="row[note]" cols="30" placeholder="{:__('Remarks Information')}">{$row.remark|default=''}</textarea>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-4">{:__('Assembly cost')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-costs" class="form-control price_decimal" step="0.01" name="row[costs]" type="number" value="{$row.money|default=''}" placeholder="{:__('Assembly cost')}">
                </div>
            </div>
        </div>
    </div>
    <input type="hidden" name="temp_name" id="temp_name">

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
